﻿unit SrvFltUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, JvExControls, JvXPCore, JvXPBar, ComCtrls, JvExComCtrls, JvComCtrls,
  ExtCtrls,  DBGridEh, GridsEh, {GridToXLS,} {SetGridEh,}
  JvFormPlacement, JvComponentBase, JvAppStorage, JvAppIniStorage, {RK_BD,} DB,
  StdCtrls, FIBDataSet, pFIBDataSet, JvExMask, JvToolEdit, JvBaseEdits, Mask,
  DBCtrlsEh, JvXPButtons, MemTableDataEh, MemTableEh, DModule;

 procedure InitSFTable(Tbl: TMemTableEh);

implementation

procedure InitSFTable(Tbl: TMemTableEh);
 var DS: TpFIBDataSet;
begin
 Tbl.Close;
 Tbl.EmptyTable;
 //создаем таблицу
 Tbl.FieldDefs.Add('Flag',ftBoolean);
 Tbl.FieldDefs.Add('Srv',ftString,32);
 Tbl.FieldDefs.Add('Name',ftString,128);
 Tbl.CreateDataSet;
 Tbl.Open;
 //заполняем таблицу данными
 dm1.ds_Srv_lookup.Open;
 DS:=dm1.ds_Srv_lookup;
 DS.First;
 while not DS.Eof do
  begin
   Tbl.Append;
   Tbl.FieldByName('Flag').AsBoolean:=true;
   Tbl.FieldByName('Srv').AsString:=DS.FN('Code').AsString;
   Tbl.FieldByName('Name').AsString:=DS.FN('Name').AsString;
   Tbl.Post;
   DS.Next;
  end;
 Tbl.First; 
end;

end.
